package io;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets;

/*
使用转换流输入输出流实现文本文件读取
 */
public class ISRDemo {
    public static void main(String[] args) throws IOException {
        FileInputStream fis=new FileInputStream("osw.txt");
      //  FileInputStream fis=new FileInputStream("./src/main/java/io/ISRDemo.java");
        InputStreamReader isr=new InputStreamReader(fis, StandardCharsets.UTF_8);

//        int d=isr.read();
//        System.out.println((char)d);

        int d;
        while ((d=isr.read())!=-1){
            System.out.println((char)d);
        }
        isr.close();

    }
}
